﻿using FluentNHibernate.Mapping;
using PCE.Domain;

namespace PCE.Configuration.NH.Mappings
{
	public class TenderMap : ClassMap<Tender>
	{
		public TenderMap()
		{
			Id(m => m.Id).GeneratedBy.Identity();

			NaturalId().ReadOnly().Property(m => m.Number).ReadOnly();

			Map(m => m.Title).Not.Nullable();

			Map(m => m.Annotation);
			Map(m => m.Text);
			Map(m => m.Created);
			Map(m => m.CompanyStartDate);
			Map(m => m.CompanyFinishDate);
			Map(m => m.RequiredPhoneCallAmount);
			Map(m => m.Category);
			Map(m => m.InProgress);

			References(m => m.Customer)
				.Column("CustomerId");

		}
	}
}